﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace XNA.BLEND.dom {
  internal class SDNAName {
    internal SDNAName( string name ) {
      this.Name = name;

      this.SimpleName = this.Name;
      if ( this.SimpleName.Contains( "*" ) ) {
        this.SimpleName = this.SimpleName.Replace( "*", "" );
        this.IsPointer = true;
      }
      else {
        this.IsPointer = false;
      }

      int start = this.SimpleName.IndexOf( "[" );
      if ( start >= 0 ) {
        string arrayindexes = this.SimpleName.Substring( start, this.SimpleName.Length - start );
        this.SimpleName = this.SimpleName.Remove( start );
        this.ArrayIndexes = arrayindexes.Replace( "][", "," ).Replace( "[", "" ).Replace( "]", "" );
        this.IsArray = true;
      }
      else {
        this.IsArray = false;
      }

      if ( this.SimpleName.Contains( "(" ) ) {
        this.SimpleName = this.SimpleName.Replace( "(", "" ).Replace( ")", "" );
        this.IsFunction = true;
      }
      else {
        this.IsFunction = false;
      }
    }

    internal string Name;
    internal string SimpleName;
    internal bool IsPointer;
    internal bool IsArray;
    internal bool IsFunction;
    internal string ArrayIndexes;
    internal int ArrayDimension;
  }
}
